package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/*
对象流高级流

ObjectInputStream/ObjectOutputStream
作用：进行对象的序列化和反序列化
对象序列化：讲一个java对象转换为一组字节
对象反序列化:将一组字节转化为java对象
 */
public class OOSDemo {
    public static void main(String[] args) throws IOException {
      String name="猪婆";
      int age=22;
      String gender="ts";
      String[]other={"我是云南的","云南怒江的","怒江泸水市","泸水市六库"};
      Student ss=new Student(name,age,gender,other);
        System.out.println(ss);


        FileOutputStream file=new FileOutputStream("student.obj");
        ObjectOutputStream oos=new ObjectOutputStream(file);
        oos.writeObject(ss);//序列化方法
        System.out.println("书写完毕");

    }
}
